﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace Krile.Forms.ConfigForm.Children
{
    public partial class Timeline : Krilib.Control.ConfigPage
    {
        public Timeline()
        {
            InitializeComponent();
        }

        private void Timeline_Load(object sender, EventArgs e)
        {
            ListBottomNewer.Checked = Core.Config.Timeline.ListBottomNewer;
            ManageReadFlags.Checked = Core.Config.Timeline.ManageReadFlags;
        }

        public override void Apply()
        {
            bool updatecpz = false;
            if (Core.Config.Timeline.ListBottomNewer != ListBottomNewer.Checked)
                updatecpz = true;
            Core.Config.Timeline.ListBottomNewer = ListBottomNewer.Checked;
            Core.Config.Timeline.ManageReadFlags = ManageReadFlags.Checked;
            base.Apply();

            //sort direction updated
            if (updatecpz)
                Cores.StatusManager.StatusServerSorts.StatusSortComparisonUpdateInvoke();
        }

        private void EditNGSDC_Click(object sender, EventArgs e)
        {
            using (var d = new Dialogs.Editor.SearchData.SearchDataClusterEditor())
            {
                d.SearchDataCluster = Core.Config.Timeline.NGSDClusters;
                if (d.ShowDialog() == DialogResult.OK)
                {
                    Core.Config.Timeline.NGSDClusters = d.SearchDataCluster;
                }
            }
        }
    }
}
